/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.test;

import javax.swing.JApplet;

/**
 *
 * @author kamal
 */
import javax.swing.*;
import java.awt.event.*;

public class JAppletNews extends JApplet {

   
    javax.swing.Timer timer;
    public void init() {

    final JLabel texte = new JLabel(getParameter("texte"));
   
    texte.setLocation(0, getHeight());
   // texte.setSize(texte.getPreferredSize());

    //getContentPane().setLayout (null);
    getContentPane().add(texte);
    
    ActionListener timerListener = new ActionListener()
      {
        public void actionPerformed (ActionEvent ev)
        {
          int y = texte.getY();
          if (y < -1)
              y = getHeight();
          else
            y--;
          
          texte.setLocation(texte.getX(), y);
        
        }
      };

    this.timer = new Timer(50, timerListener);
    }

   public void start()
  {
    this.timer.start();
  }

  public void stop()
  {
    this.timer.stop();
  }

  
    
  /*private Timer timer;
  public void init()
  {

    final JLabel texte = new JLabel(getParameter ("texte"));
    texte.setLocation(0, getHeight());
    texte.setSize(texte.getPreferredSize());

    getContentPane().setLayout (null);
    getContentPane().add(texte);

    ActionListener timerListener = new ActionListener()
      {
        public void actionPerformed (ActionEvent ev)
        {
          int y = texte.getY();
          if (y < -texte.getHeight())
            y = getHeight();
          else
            y--;
          texte.setLocation(texte.getX(), y);
        }
      };

    this.timer = new Timer(50, timerListener);
  }

  public void start()
  {
    this.timer.start(); 
  }

  public void stop()
  {
    this.timer.stop(); 
  }
*/
}
